import { createRouter, createWebHistory ,createWebHashHistory} from 'vue-router' 

import Home from '@/eleview/Home.vue'
import Category from '@/eleview/Category.vue'
import News from '@/eleview/News.vue'

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL), //创建一个H5模式的路由，createWebHashHistory //是创建 # hash模式的路由。   http://www.em.com/login , http://www.em.com/#/login
  routes: [ 
    {
      path: '/',
      component:Home, 
      children:[
        {
          path:"categories",
          component:Category
        },
        {
          path:"news",
          component:News
        }
      ]
    } 
  ],
})

router.beforeEach((to,from)=>{
  console.log("guard===> ",to,from)
  //session是不是过期

})

export default router
